package net.kts.story.twitter;

import net.kts.story.twitter.contator.TwitterConator;
import net.kts.story.twitter.oauth.OAuth;
import twitter4j.TwitterException;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class TwitterActivity extends Activity {
	protected TwitterConator twiitterConator;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		try {
			OAuth oAuth = new OAuth(this);
			twiitterConator = new TwitterConator(this, oAuth);
			Log.d("twitter","OAuthActivity created" + twiitterConator.toString());
		} catch (TwitterException e) {
			Log.e("twitter", e.getErrorMessage());
		}
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if(resultCode ==RESULT_OK)
		if(requestCode==1)
		if(data.getStringExtra("PIN") != null)
			twiitterConator.obtainCertification(data.getStringExtra("PIN"));
	}
}
